package com.cloud.hotline.api.entity;

import java.util.Date;
import javax.persistence.*;

import com.cloud.hotline.api.consts.HotLineConsts;
import com.fasterxml.jackson.annotation.JsonFormat;

@Table(name = "to_hotline_record")
public class ToHotlineRecord {
	@Id
	@Column(name = "record_id")
	private Integer recordId;

	@Column(name = "data_type_id")
	private Integer dataTypeId;

	@Column(name = "yessw_num")
	private String yesswNum;

	@Column(name = "dispatch_date")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date dispatchDate;

	@Column(name = "record_type_name")
	private String recordTypeName;

	@Column(name = "reporter_name")
	private String reporterName;

	@Column(name = "record_desc")
	private String recordDesc;

	@Column(name = "desc_short")
	private String descShort;

	private String address;

	@Column(name = "call_num")
	private String callNum;

	@Column(name = "dispatch_type")
	private String dispatchType;

	@Column(name = "receive_unit_type")
	private int receiveUnitType;
	
	@Column(name = "receive_unit_name")
	private String receiveUnitName;

	@Column(name = "record_state_name")
	private String recordStateName;

	@Column(name = "nonstate_reason")
	private String nonstateReason;

	@Column(name = "street_receive_date")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date streetReceiveDate;

	@Column(name = "unit_receive_date")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date unitReceiveDate;

	@Column(name = "unit_type")
	private int unitType;
	
	@Column(name = "unit_name")
	private String unitName;

	@Column(name = "record_handle_desc")
	private String recordHandleDesc;

	@Column(name = "revisit_date")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date revisitDate;
	
	@Column(name = "answer_flag_name")
	private String answerFlagName;

	@Column(name = "finish_flag_name")
	private String finishFlagName;

	@Column(name = "pleased_flag_name")
	private String pleasedFlagName;

	@Column(name = "city_revisit_date")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date cityRevisitDate;
	
	@Column(name = "city_finish_flag_name")
	private String cityFinishFlagName;

	@Column(name = "city_pleased_flag_name")
	private String cityPleasedFlagName;
	
	@Column(name = "rec_disp_num")
	private String recDispNum;

	@Column(name = "coor_x")
	private Float coorX;

	@Column(name = "coor_y")
	private Float coorY;

	@Column(name = "insert_time")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date insertTime;

	@Column(name = "last_modify_time")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date lastModifyTime;

	@Column(name = "delete_flag")
	private Integer deleteFlag;

	@Column(name = "delete_time")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date deleteTime;
	
	@Column(name = "state_date")
	@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
	private Date stateDate;
	
	public ToHotlineRecord() {
	}

	// 诉求三率：市级回访
	public ToHotlineRecord(ToHotlineRevisitRecord record) {
		this.dataTypeId = HotLineConsts.DATA_TYPE_CITY_REVISIT;
		this.yesswNum = record.getYesswNum();
		this.dispatchDate = record.getDispatchTime();
		this.recordTypeName = record.getRevisitType();
		this.reporterName = record.getReporterName();
		this.recordDesc = record.getRecordDesc();
		this.callNum = record.getCallNum();
		this.dispatchType = record.getRevisitType();
		this.receiveUnitName = record.getUnitName();
		this.unitName = record.getUnitName();
		this.recordHandleDesc = record.getRecordHandleProc();
		this.answerFlagName = record.getAnswerFlag();
		this.cityRevisitDate = new Date(); //考核时间为当天
		this.cityFinishFlagName = record.getFinishFlag();
		this.cityPleasedFlagName = record.getPleasedFlag();
		this.recDispNum = record.getRecNum();
		this.stateDate = this.dispatchDate; // 派单时间
	}
	
	//街道承办
	public ToHotlineRecord(ToHotlineStreetRecord cr) {
		this.dataTypeId = HotLineConsts.DATA_TYPE_STREET_UNDERTAKE;
		this.yesswNum = cr.getYesswNum();
		this.reporterName = cr.getReporterName();
		this.address = cr.getAddress();
		this.callNum = cr.getCallNum();
		this.receiveUnitName = cr.getUnitName();
		this.unitName = cr.getUnitName();
		this.recordTypeName = cr.getRecordTypeName();
		this.dispatchType = cr.getDispatchType();
		this.nonstateReason = cr.getNonstatReason();
		this.streetReceiveDate = cr.getStateDate();
		this.stateDate = cr.getStateDate();
	}
	
	//区级回访  or 部门承办
	public ToHotlineRecord(ToHotlineUnitRecord cr) {
		this.dataTypeId = cr.getDataTypeId(); //区分：有可能是部门承办
		this.yesswNum = cr.getYesswNum();
		this.dispatchDate = cr.getReportTime();
		this.dispatchType = cr.getEventSrcName();
		this.recordTypeName = cr.getSuperviseType();
		this.reporterName = cr.getReporterName();
		this.recordDesc = cr.getRecordDesc();
		this.address = cr.getAddress();
		this.callNum = cr.getCallNum();
		this.receiveUnitName = cr.getUnitName();
		this.recordStateName = cr.getRecState();
		this.unitReceiveDate = cr.getStateDate();//接收时间
		this.unitName = cr.getUnitName();
		this.recordHandleDesc = cr.getHandleDesc();
		this.answerFlagName = cr.getUnitFeedback();
		this.finishFlagName = cr.getSloveFlag();
		this.pleasedFlagName = cr.getPleasedFlag();
		this.recDispNum = cr.getRecNum();
		this.revisitDate = cr.getFeedbackTime();
		this.coorX = cr.getCoordinateX();
		this.coorY = cr.getCoordinateY();
		this.stateDate = cr.getStateDate(); // 回访时间
	}

	public Integer getRecordId() {
		return recordId;
	}

	public void setRecordId(Integer recordId) {
		this.recordId = recordId;
	}

	public Integer getDataTypeId() {
		return dataTypeId;
	}

	public void setDataTypeId(Integer dataTypeId) {
		this.dataTypeId = dataTypeId;
	}

	public String getYesswNum() {
		return yesswNum;
	}

	public void setYesswNum(String yesswNum) {
		this.yesswNum = yesswNum;
	}

	public Date getDispatchDate() {
		return dispatchDate;
	}

	public void setDispatchDate(Date dispatchDate) {
		this.dispatchDate = dispatchDate;
	}

	public String getRecordTypeName() {
		return recordTypeName;
	}

	public void setRecordTypeName(String recordTypeName) {
		this.recordTypeName = recordTypeName;
	}

	public String getReporterName() {
		return reporterName;
	}

	public void setReporterName(String reporterName) {
		this.reporterName = reporterName;
	}

	public String getRecordDesc() {
		return recordDesc;
	}

	public void setRecordDesc(String recordDesc) {
		this.recordDesc = recordDesc;
	}

	public String getDescShort() {
		return descShort;
	}

	public void setDescShort(String descShort) {
		this.descShort = descShort;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getCallNum() {
		return callNum;
	}

	public void setCallNum(String callNum) {
		this.callNum = callNum;
	}

	public String getDispatchType() {
		return dispatchType;
	}

	public void setDispatchType(String dispatchType) {
		this.dispatchType = dispatchType;
	}

	public String getReceiveUnitName() {
		return receiveUnitName;
	}

	public void setReceiveUnitName(String receiveUnitName) {
		this.receiveUnitName = receiveUnitName;
	}

	public String getRecordStateName() {
		return recordStateName;
	}

	public void setRecordStateName(String recordStateName) {
		this.recordStateName = recordStateName;
	}

	public String getNonstateReason() {
		return nonstateReason;
	}

	public void setNonstateReason(String nonstateReason) {
		this.nonstateReason = nonstateReason;
	}

	public Date getStreetReceiveDate() {
		return streetReceiveDate;
	}

	public void setStreetReceiveDate(Date streetReceiveDate) {
		this.streetReceiveDate = streetReceiveDate;
	}

	public Date getUnitReceiveDate() {
		return unitReceiveDate;
	}

	public void setUnitReceiveDate(Date unitReceiveDate) {
		this.unitReceiveDate = unitReceiveDate;
	}

	public Date getRevisitDate() {
		return revisitDate;
	}

	public void setRevisitDate(Date revisitDate) {
		this.revisitDate = revisitDate;
	}

	public String getUnitName() {
		return unitName;
	}

	public void setUnitName(String unitName) {
		this.unitName = unitName;
	}

	public String getRecordHandleDesc() {
		return recordHandleDesc;
	}

	public void setRecordHandleDesc(String recordHandleDesc) {
		this.recordHandleDesc = recordHandleDesc;
	}

	public String getAnswerFlagName() {
		return answerFlagName;
	}

	public void setAnswerFlagName(String answerFlagName) {
		this.answerFlagName = answerFlagName;
	}

	public String getFinishFlagName() {
		return finishFlagName;
	}

	public void setFinishFlagName(String finishFlagName) {
		this.finishFlagName = finishFlagName;
	}

	public String getPleasedFlagName() {
		return pleasedFlagName;
	}

	public void setPleasedFlagName(String pleasedFlagName) {
		this.pleasedFlagName = pleasedFlagName;
	}

	public String getRecDispNum() {
		return recDispNum;
	}

	public void setRecDispNum(String recDispNum) {
		this.recDispNum = recDispNum;
	}

	public Float getCoorX() {
		return coorX;
	}

	public void setCoorX(Float coorX) {
		this.coorX = coorX;
	}

	public Float getCoorY() {
		return coorY;
	}

	public void setCoorY(Float coorY) {
		this.coorY = coorY;
	}

	public Date getInsertTime() {
		return insertTime;
	}

	public void setInsertTime(Date insertTime) {
		this.insertTime = insertTime;
	}

	public Date getLastModifyTime() {
		return lastModifyTime;
	}

	public void setLastModifyTime(Date lastModifyTime) {
		this.lastModifyTime = lastModifyTime;
	}

	public Integer getDeleteFlag() {
		return deleteFlag;
	}

	public void setDeleteFlag(Integer deleteFlag) {
		this.deleteFlag = deleteFlag;
	}

	public Date getDeleteTime() {
		return deleteTime;
	}

	public void setDeleteTime(Date deleteTime) {
		this.deleteTime = deleteTime;
	}

	public int getReceiveUnitType() {
		return receiveUnitType;
	}

	public void setReceiveUnitType(int receiveUnitType) {
		this.receiveUnitType = receiveUnitType;
	}

	public int getUnitType() {
		return unitType;
	}

	public void setUnitType(int unitType) {
		this.unitType = unitType;
	}

	public Date getStateDate() {
		return stateDate;
	}

	public void setStateDate(Date stateDate) {
		this.stateDate = stateDate;
	}

	public Date getCityRevisitDate() {
		return cityRevisitDate;
	}

	public void setCityRevisitDate(Date cityRevisitDate) {
		this.cityRevisitDate = cityRevisitDate;
	}

	public String getCityFinishFlagName() {
		return cityFinishFlagName;
	}

	public void setCityFinishFlagName(String cityFinishFlagName) {
		this.cityFinishFlagName = cityFinishFlagName;
	}

	public String getCityPleasedFlagName() {
		return cityPleasedFlagName;
	}

	public void setCityPleasedFlagName(String cityPleasedFlagName) {
		this.cityPleasedFlagName = cityPleasedFlagName;
	}
	
}